package com.example.testproject;
//coucou
import java.util.ArrayList;

import com.example.testproject.entities.Spectacle;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
 
public class MyAdapter extends ArrayAdapter<Spectacle> implements OnClickListener{
 
        private final Context context;
        //private final ArrayList<Item> itemsArrayList;
        private final ArrayList<Spectacle> spectacleArrayList;
 
        public MyAdapter(Context context, ArrayList<Spectacle> spectacleArrayList) {
 
            super(context, R.layout.row, spectacleArrayList);
 
            this.context = context;
            this.spectacleArrayList = spectacleArrayList;
        }
        
 
       

		@Override
        public View getView(int position, View convertView, ViewGroup parent) {
 
            // 1. Create inflater 
            LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
            // 2. Get rowView from inflater
            View rowView = inflater.inflate(R.layout.row, parent, false);
 
            // 3. Get the two text view from the rowView
            TextView labelView = (TextView) rowView.findViewById(R.id.label);
            TextView valueView = (TextView) rowView.findViewById(R.id.value);
 
            // 4. Set the text for textView 
            labelView.setText(spectacleArrayList.get(position).getInfos());
            valueView.setText(spectacleArrayList.get(position).getDuree());
            
            //rowView.setOnClickListener();
 
            // 5. retrn rowView
            return rowView;
        }




		@Override
		public void onClick(View view) {
			Log.i(DEBUG, msg)
			
		}
}